#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N];

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, s; cin >> n >> s;
    for (int i = 1; i <= n; i++) cin >> a[i];
    int sum = 0, ans = n + 1;
    for (int i = 1, j = 0; i <= n; i++) {
        while (i > j || (j + 1 <= n && sum < s)) {
            j++; sum += a[j]; //sum+=a[++j];
        }
        if (sum >= s) ans = min(ans, j - i + 1);
        sum -= a[i];
    }
    if (ans > n) cout << 0 << '\n';
    else cout << ans << '\n';
    return 0;
}